<template lang="jade">
h-loader-full(url='loader',:setdata='false')
  h-data-lister(data='list')
  .box
    //人员信息
    table.list
      ml-header(data='课程名,姓名,电话,是否反馈,发布时间,反馈时间,备注,操作')
      tr(v-for='(n,i) in list')
        td {{n.cul_name}}
        td {{n.username}}
        td {{n.mobile}}
        td: input(type='checkbox',v-model='n.islink')
        td {{new Date(n.time_create * 1000).format('yyyy-MM-dd hh:mm:ss') }}
        td(v-if="n.time_check") {{new Date(n.time_check * 1000).format('yyyy-MM-dd hh:mm:ss') }}
        td(v-else)
        td: input(type='text',v-model='n.remark')
        td
          a(href='javascript:void(0)',@click='check(n)') 更新
          
    .command
      .page
        button(v-show='page>1', @click="pagego('last')") 上一页
        button {{page}}
        button(@click="pagego('next')") 下一页
        a.button(href='javascript:void(0)',@click='download()') 导出
        span &nbsp;&nbsp;&nbsp;&nbsp;总共{{count_num}}条记录
</template>

<script>
import { MessageBox } from 'mint-ui'
export default {
	data () {
		return {
			loader:{
        list:'get/cultivateapplyinfo/info?page=1'
        },
      list:[],
      page:1,
      count_num:0,

		}
	},
  mounted () {
  this.getcount()
  },
	methods: {
		loadAfter(data){
      this.list=data.list
		},
    check(obj){
      console.log('obj==',obj)
      this.$ajax.put('update/cultivateapplyinfo',{'id':obj.id,'islink':obj.islink,'remark':obj.remark},(res)=>{
        this.$msg.success('更新成功')
        setTimeout('window.location.reload()',1500)
      },(res)=>{
        this.$msg.error('更新失败')
      })
    },
    download(){
        var now_url = window.location.href;
        var site_root = "http://"+now_url.split("/")[2];
      	window.location.href = site_root+'/rest/get/excel/jobseeker/info'
        //window.location.href = 'http://127.0.0.1:5110/rest/get/excel/cultivateapplyinfo/info'
    },
    // 分页
    pagego (type) {
      this.page = type == 'last' ? this.page - 1 : this.page + 1
      this.$ajax.get('get/cultivateapplyinfo/info?&page=' + this.page, (res) => {
        this.list = res.data
      }, (res) => {
        this.error(res.message)
      })
    },
    getcount(){
      this.$ajax.get('get/cultivateapplyinfo/count', (res) => {
        var count_num = 0;
        this.count_num = res.data[0].countnum
      }, (res) => {
        this.error(res.message)
      })
    },
	}
}
</script>
<style>
  .button{background: #ff5700; padding: 2%; color: #fff; text-decoration-line: none;}
</style>
